This script automates the process of organizing and managing files in specified directories. It categorizes files based on their types and moves older files to an archive folder, helping you maintain a well-organized file structure with minimal manual effort.
File Organization Automation Script is available in two versions: a .bat script and a .ps1 script. Both scripts categorize files into different categories based on their file types and move files older than a specified threshold to an archive folder.
File Categorization: The .bat script identifies the file type of each file based on its extension and categorizes it accordingly (e.g., images, documents, videos).
Age-Based Archiving: Files are evaluated for their age. Files older than a defined threshold (default: 45 days) are moved to an archive folder within the respective category.
Automatic Organization: The script creates destination directories for each file category in both "active" and "archive" directories. It then moves files to the appropriate category based on their file type and age.
File Categorization: The .ps1 script identifies the file type of each file based on its extension and categorizes it accordingly (e.g., images, documents, videos).
Age-Based Archiving: Files are evaluated for their age. Files older than a defined threshold (default: 45 days) are moved to an archive folder within the respective category.
Automatic Organization: The script creates destination directories for each file category in both "active" and "archive" directories. It then moves files to the appropriate category based on their file type and age.
Download the Script: Download the FileOrganization.bat
script to the directory you want to organize.
Run the Script: Double-click the FileOrganization.bat
script or run it using the command prompt.
File Organization: The script will automatically categorize files in the source directory into appropriate categories based on their extensions and move older files to the archive directory as per the defined threshold.
Download the Script: Download the FileOrganization.ps1
script to the directory you want to organize.
Run the Script: Open PowerShell, navigate to the directory containing the script, and run it using the following command:
.\FileOrganization.ps1
File Organization: The script will automatically categorize files in the source directory into appropriate categories based on their extensions and move older files to the archive directory as per the defined threshold.
Customization (Optional): You can customize the script by modifying source/destination directories, the file age threshold, or add more conditions for file types and actions as needed.
graph LR subgraph Source Directory A[Start] --> B(Get Source Directory) B --> C(Get Current Date) C --> D(Process Files) end subgraph Process Files D --> E(Get File) E --> F(Determine File Extension) F --> G(Is File Type Recognized?) G -->|No| H(Set File Category to Other) G -->|Yes| I(Set File Category) I --> J(Check File Age) J -->|Older| K(Move to Archive Directory) J -->|Not Older| L(Move to Active Directory) H --> L(Move to Active Directory) L --> E K --> E E -->|All Files Processed| M[End] end subgraph Destination Directories N[Active Directory] O[Archive Directory] end B -->|Set Directories| N N -->|Set up Categories| O
$daysThreshold
variable in the scripts.